import grails.util.Environment

import java.util.Date

class BootStrap 
{
	def authenticateService
	
    def init = { servletContext ->
        switch (Environment.current) 
        {
            case Environment.DEVELOPMENT:
                popularBancoDeDados()	
                break;
            case Environment.TEST:
                popularBancoDeDados()	
                break;
            case Environment.PRODUCTION:
                println "Nenhuma configuração especial necessária"
                break;
        }
		
		
    }

    def destroy = {
    }
	
    void popularBancoDeDados()
    {
		// inicializa estado referentes as ações
		new Acao(id: 1, nome: 'hold').save(failOnError: true)
		new Acao(id: 2, nome: 'deploy').save(failOnError: true)
		new Acao(id: 3, nome: 'delete').save(failOnError: true)
		new Acao(id: 4, nome: 'release').save(failOnError: true)
		new Acao(id: 5, nome: 'restart').save(failOnError: true)
		new Acao(id: 6, nome: 'suspend').save(failOnError: true)
		new Acao(id: 7, nome: 'migrate').save(failOnError: true)
		new Acao(id: 8, nome: 'livemigrate').save(failOnError: true)
		new Acao(id: 9, nome: 'stop').save(failOnError: true)
		new Acao(id: 10, nome: 'copy').save(failOnError: true)
		new Acao(id: 11, nome: 'cancel').save(failOnError: true)
		new Acao(id: 12, nome: 'shutdown').save(failOnError: true)
		new Acao(id: 13, nome: 'resume').save(failOnError: true)
    }
}
